<?php 
$next_p = ($curPage>=$totalPage)?$totalPage:$curPage+1;
$prev_p = ($curPage<=1)?1:$curPage-1;
if ($pd_type =='free' && empty($wangqi)){ 
    $page_act_next = "goProduct($product_cat,$next_p)";
    $page_act_prev = "goProduct($product_cat,$prev_p)";
} else if ($pd_type =='free' && !empty($wangqi)){ 
    $page_act_next = "goWangqi($next_p)";
    $page_act_prev = "goWangqi($prev_p)";    
} else if ($pd_type =='convert'){ 
    $page_act_next = "goConvert($next_p)";
    $page_act_prev = "goConvert($prev_p)";    
} 
?>
<?php if (empty($totalPage)) {  
    $pager = '';   
} else { 
    $path = SystemProperties::$path;
    $pager = "<a href='javascript:$page_act_prev'><img src='{$path}/image/new/goprev.gif' border='0' /></a><b>&nbsp;{$curPage}/{$totalPage}&nbsp;</b><a href='javascript:{$page_act_next}'><img src='{$path}/image/new/gonext.gif' border='0'/></a>";
} ?>
<?php if ($pd_type=='free' && empty($wangqi)) { ?>

<div class="applytab">
    
    <?php if ($_SESSION['cutepig']==1) { ?>
    <span class="applytab_bt_<?=$product_cat==2?'now':'x';?> applytab_bigger" onclick="freeProductShowCat(2)">开心猪倌专区</span>
    <?php } ?>
    <?php if (!empty($_SESSION['parterner'])) {
        $s_cat_id = SystemProperties::$paterner_class[$_SESSION['parterner']];
        $t_cat_name = SystemProperties::$catname[$s_cat_id];
        if (!empty($t_cat_name) && !empty($s_cat_id)) {
        ?>
        <span class="applytab_bt_<?=$product_cat==$s_cat_id?'now':'x'?> applytab_bigger" onclick="freeProductShowCat(<?=$s_cat_id?>)"><?=$t_cat_name?>专区</span>
        
        <?php } ?>
    <?php } ?>


    <span class="applytab_bt_<?=$product_cat==0?'now':'x';?> applytab_bigger" onclick="freeProductShowCat(0)">品牌宝贝</span>
    <?php /* <span class="applytab_bt_<?=$product_cat==88?'now':'x';?> applytab_bigger" onclick="freeProductShowCat(88)">淘宝宝贝</span>*/ ?>
    <span class='applytab_hint'>
    截至今日共展开了<b style="color:blue"><?=$product_stat['product_total']?></b>个赚宝活动，<b style="color:blue"><?=$product_stat['luck_total']?></b>人次赚得宝贝。
    </span>
    <span class="applytab_pager" ><?=$pager?></span>
</div>

<?php } ?>
<?php if ($pd_type=='convert' && empty($wangqi)) { ?>

<div class="applytab">
    <span class="applytab_bt_now applytab_bigger" >品牌宝贝</span>
    <span class='applytab_hint'>
    截至今日共展开了<b style="color:blue"><?=$product_stat['product_total']?></b>个换宝活动，<b style="color:blue"><?=$product_stat['luck_total']?></b>人次换得宝贝。
    </span>
    <span class="applytab_pager" ><?=$pager?></span>
</div>

<?php } ?>
<?php if (!empty($wangqi)) { ?>

<div class="applytab">
    <span class="applytab_bt_<?=$product_cat==0?'now':'x';?> applytab_bigger" >往期宝贝</span>
    <span class='applytab_hint'>
    截至今日共展开了<b style="color:blue"><?=$product_stat['product_total']?></b>个赚宝活动，<b style="color:blue"><?=$product_stat['luck_total']?></b>人次赚得宝贝。
    </span>
    <span class="applytab_pager" ><?=$pager?></span>
</div>
<?php } ?>

<div class="free_product_list" >
	<script type="text/javascript" >
	<?php 
	if (empty($product_free_curPage)){
		$product_free_curPage= 0;
	}
	if (empty($change_product_curPage)){
		$change_product_curPage= 0;
	}
	switch ($pd_type) {
	 case 'free' :	echo "var nowFRcurPage = {$product_free_curPage};";break;
	 case 'convert' :	echo "var nowCGcurPage = {$change_product_curPage};";break;
	}
	?>
	</script>
<ul class="plist">
	<?php 
		if(!empty($productFreeList)){
			foreach($productFreeList as $key => $value)
			{	
        		if ($pd_type=='free') { 
        			$click_link_url = "javascript:showProduct('{$value['i']['g_id']}');";	
        		}else if ($pd_type=='convert'){
        			$click_link_url = "javascript:showChangeProduct('{$value['i']['g_id']}');";
        		}
			    ?>		

	<li>
	<div class="product_img" id="p_img_<?=$value['i']['g_id']?>">
	<div class="product_img_down">
	<?php if(!empty($value['i']['g_img'])) { ?><img border='0' width="175" height="175" src="<?php echo SystemProperties::$app_upload_img_host;?>/<?php echo $value['i']['g_img']; ?>"/><?php } ?>
	</div>
	<div class="product_img_up">
	<a href="<?=$click_link_url?>" ><img src="<?=SystemProperties::$path;?>/image/product_bg.gif" /></a>
	</div>
	</div>
	<div class="product_name">
	<span class="product_name_span">
	<?=$value['i']['g_name']?>
	<?php if($value['i']['g_hot'] == 1) {?><font color="red">[HOT]</font></td><?php } ?>
	</span>
	<span class="product_name_span">	
	<?php if ($pd_type=='free') { ?>
	
	市场价:<?=$value['i']['g_jiazhi']?>元<br />
	<?php } else if ($pd_type=='convert') { ?>
	市场价:<?=$value['i']['g_jiazhi']?>元
	<?php if ($value['i']['g_exchanges']>0) { ?>
	   需要积分:<b class='rmb'><?php echo $value['i']['g_exchanges']; ?></b><br />
	<?php } ?>
	<?php if ($value['i']['g_exchanges_gold']>0) { ?>
	   需要<b class='rmb'>金币</b>:<b class='rmb'><?php echo $value['i']['g_exchanges_gold']; ?></b><br />
	<?php } ?>

	
	<?php } ?>
	</span>

	<span>
	总:<b style="color:blue"><?=($value['i']['type']=='coupon')?'若干':($value['i']['g_number'] + $value['i']['g_sent'])?></b>份
	&nbsp;&nbsp;
	已送:<b style="color:blue"><?=$value['i']['g_sent']?></b>份
	</span>

	</div>
	</li>
	<?php } ?>
<?php } ?>

</ul>
</div>
<div class="free_product_list_bot"><span class="applytab_pager" ><?=$pager?></span></div>


